#include "../header.h"

//1.fork
//2.kill

int main(int argc, char const *argv[])
{
    
    pid_t pid = fork();
    if(pid < 0 )
        exit(-1);
    //父进程空间
    if(pid > 0 )
    {
        int num = 10;
        while(num--)
        {
            /* code */
            printf("this is parents process:%d\n",getpid());
            sleep(1);
            if(num == 5)
                kill(pid,SIGINT);
        }
        wait(NULL);
    }
    //子进程空间
    if (pid == 0 )
    {
        while(1)
        {
            /* code */
            printf("this is child process:%d\n",getpid());
            sleep(1);
        }
    }


    return 0;
}
